﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using Microsoft.Phone.Controls.Maps;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
namespace CapstoneWinPhone.Data
{
    public class MileageReport
    {
        
        public string _name { get; set; }
        public string _description { get; set; }
        public ObservableCollection<Trip> _trips { get; set; }

        public double _TotalMiles
        {
            get
            {
                if (_trips.Count > 0)
                    return _trips.Sum(t => t.TotalMileage);
                else
                    return 0;
            }
            set
            {
                ;
            }
        }

        public MileageReport()
        {

        }

        public MileageReport(string name, string description)
        {
            _name = name;
            _trips = new ObservableCollection<Trip>();
            _description = description;
        }

        public void newTrip(LocationCollection locations, string description)
        {
            _trips.Add(new Trip(locations, description));
        }

        public override string ToString()
        {
            return "" + _name + "  -  " + _TotalMiles.ToString("#.##");
        }
        
    }
}
